{% extends "base.html" %}
{% block menu %}
 <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="brand" href="#">Project Manager System</a>
          <div class="nav-collapse collapse">
            <ul class="nav">
              <li><a href="/admfase/{{session['proyectoid']}}">Administrar Fase</a></li>
              <li class="active"><a href="/admlinea/">Administrar Linea Base</a></li>
              <li><a href="/">Logout</a></li>
              <li><a href="#contact">Usuario: {{session['username']}}</a></li>
              </ul>
          </div>
         </div>
        </div>
</div>
{%endblock%}
{%block mensaje%}
        {% with messages = get_flashed_messages(with_categories=true) %}
          {% if messages %}
          <div class="container" align="center">
            {% for category, message in messages %}
              <h4 class="{{ category }}">{{ message }}</h4>
            {% endfor %}
		  </div>
          {% endif %}
        {% endwith %}
{%endblock%}
{%block content%}
<div class="lineas">
		<div class="container" align="center">
        <h3 class="muted">{{session['proyectonombre']}} - {{session['fasenombre']}}</h3>
        </div>
        <div class="row" >
                <div class="span12">
                        <h2> Listado de Lineas Base </h2>
                        <table class="table table-striped table-bordered">
                                <tr>
                                        <th>Numero</th>
                                        <th>Comentario</th>
				                        <th>Fecha Creación</th>
				                        <th>Creador</th>
				                        <th>Estado</th>
				                        <th>Consultar</th>
				                        
				                        <th>Cerrar</th>
				                        
                                </tr>
                                {% for l in lineas %}
                    
                                <tr>
                                        <td>{{l.numero}}</td>
                                        <td>{%if l.comentario==None%}
                                        	-
                                        	{%else%}
	                                        {{l.comentario}}
	                                        {%endif%}
	                                    </td>
                                        <td>{{l.fechaCreacion.strftime('%Y/%m/%d')}}</td>
                                        <td>{{l.creador.nombre}}</td>
                                        <td>{{l.estado}}</td>
                                        <td>
                                        {% if l.estado!="Quebrada" %}
                                        <a class="btn btn-info" href="/admlinea/concultar/{{l.id}}">Consultar</a>
                                        {% else %}
                                        <a class="btn btn-info" href="/admlinea/concultar2/{{l.id}}">Consultar</a>
                                        {%endif%}
                                        </td>
                                        <td>
                                        {% if session['usuarioid']==l.creador_id and l.estado=="Abierta" %}
		                                	<a class="btn btn-danger" href="/admlinea/cerrar/{{l.id}}">Cerrar</a>
                                        {%endif%}
                                        </td>
                        		</tr>
                                {% else %}
                         
                                <tr>
                                        No se han creado lineas base aún
                                </tr>
                                {% endfor %}
                </table>
                <a class="btn" href="/admfase/{{session['proyectoid']}}"><i class="icon-arrow-left"></i> Atras</a>
              </div>
              <div class="span3 bs-docs-sidebar">
                <ul class="nav nav-list bs-docs-sidenav">
                					{% if tienePermiso(roles,"crearLB") %}
                                  <li><a href="/admlinea/crear/"><i class="icon-chevron-right"></i> Crear Linea base</a></li>
                                	{%endif%}
                                </ul>
                        </div>
        </div>
  </div>
  
{%endblock%}